package com.esunrising.esungsc.service.impl;

import com.esunrising.esungsc.dao.SysApiUrlDao;
import com.esunrising.esungsc.entity.SysApiUrl;
import com.esunrising.esungsc.service.SysApiUrlService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Optional;


@Service
public class SysApiUrlServiceImpl implements SysApiUrlService {

    @Resource
    private SysApiUrlDao dao;

    @Override
    public void save(SysApiUrl entity) {
        // 保存数据
        dao.save(entity);
    }

    @Override
    public SysApiUrl findById(String id){
        Optional<SysApiUrl> byId = dao.findById(id);
        return byId.orElse(null);
    }

    @Override
    public SysApiUrl findByConfigKey(String configKey) {
        Optional<SysApiUrl> byConfigKey = dao.findByConfigKey(configKey);
        return byConfigKey.orElse(null);
    }

    @Override
    public String findConfigValueByConfigKey(String configKey) {
        return dao.findConfigValueByConfigKey(configKey);
    }

}